package com.huage_08.lesson_04;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAdressDemo {
    public static void main(String[] args) throws UnknownHostException {
//        InetAddress host = InetAddress.getByName("LAPTOP-HUAGE");
        InetAddress host = InetAddress.getByName("192.168.56.1");

        String hostName = host.getHostName();
        String hostAddress = host.getHostAddress();

        System.out.println("主机名:"+hostName);
        System.out.println("IP地址:"+hostAddress);
    }
}
